package com.test;

import java.util.Random;
import java.util.Scanner;

public class Guess {
    public static void main(String[] args) {
        /*//输入一个1~100的数
        Scanner sc=new Scanner(System.in);
        int number= sc.nextInt();*/
        boolean flag=false;

        //随机生成一个1~100之间的数
        Random r=new Random();
        int number=r.nextInt(100);

        //用二分法查找
        int start=1;
        int end=100;
        while (!flag){
            if (number+1>(start+end)/2){
                start=(start+end)/2+1;
            }else if (number+1==(start+end)/2){
                System.out.println(number+1);
                System.out.println((start+end)/2);
                flag=true;
            }else end=(start+end)/2-1;
        }
        //打印
    }
}
